<%--
  Created by IntelliJ IDEA.
  User: 777
  Date: 2021/6/30
  Time: 14:06
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<html>
<head>
    <title>题库-资料库-赛事星</title>
    <script type="text/javascript" src="/Eventstar/js/jquery-1.10.2.js" ></script>
    <link href="/Eventstar/css/book_in.css" rel="stylesheet" type="text/css">
</head>
<script>
    $(function (){
        $("#new1,#new2").css("display","none");

        $(".title").hover(function(){
            $(this).find(".deltimu").css("display","block");
            $(this).find(".updtimu").css("display","block");

        },function(){
            $(this).find(".deltimu").css("display","none");
            $(this).find(".updtimu").css("display","none");
        });

        $(".btn1,.btn2,.btn4").hover(function(){
            $(this).css("border","2px solid black");

        },function(){
            $(this).css("border","2px solid greenyellow");

        });

        $(".btn3").hover(function(){
            $(this).css("border","2px solid black");

        },function(){
            $(this).css("border","2px solid #CCCCCC");

        });

        //全选/全不选
        $("#CheckAll").bind("click",function(){
            $("input[name='inp']").prop("checked",this.checked);
        });

        $(".btn4").click(function (){
            $("#new1").css("display","block");
            $("#d2").css("display","none");
            $("#maxbook").css("display","none");
        })
        $(".btn2").click(function (){
            $("#new2").css("display","block");
            $("#d2").css("display","none");
            $("#maxbook").css("display","none");
        })
        $("#close").click(function (){
            $("#new1").css("display","none");
            $("#d2").css("display","block");
            $("#maxbook").css("display","block");
        })
        $("#close2").click(function (){
            $("#new2").css("display","none");
            $("#d2").css("display","block");
            $("#maxbook").css("display","block");
        })
        $("#new1 button").click(function (){
            alert("删除成功")
        })
        $("#new2 button").click(function (){
            alert("修改成功")
        })


        $(".title").delegate(".deltimu,.updtimu","mouseover",function(){
            $(this).css("border","1px solid black");
        });
        $(".title").delegate(".deltimu,.updtimu","mouseout",function(){
            $(this).css("border","");
        });

        $(".title").delegate(".deltimu","click",function (){
            var r = confirm("您确定删除该题吗？")
            if (r == true) {
                var id=$(this).attr("tmid")
                $.ajax({
                    url:"http://localhost:9090/Eventstar/book/book_deltimu",
                    data:{"qid":id},
                    type:"post",
                    success:function(result){
                        window.location.href="http://localhost:9090/Eventstar/book/book_in?bookname=${bookname}";
                        alert("删除成功");
                    }

                });
            } else {

            }

        })

    });
</script>
<body>
<img src="/Eventstar/img/book_head.jpg">
<div id="max">
    <div id="d1">
        <ul class="body-left">
            <li>
                <img src="/Eventstar/img/book_tx2.png" class="tx2">
                <div class="content">个人主页</div>
            </li>
            <br />
            <div class="xian">———————————</div>
            <li><a class="C001">我是考生</a></li> <br />
            <li><a class="font1"  href="#"> 竞赛</a></li> <br />
            <li><a class="font1" href="#">考试</a></li> <br />
            <li><a class="font1"  href="#">答题</a></li> <br />
            <div class="xian">———————————</div>
            <li><a class="C001">我是考官</a></li> <br />
            <li><a class="font1" href="/Eventstar/set/getsj">出试卷</a></li> <br />
            <li><a class="font1"  href="/Eventstar/work.jsp">作业情况</a></li> <br />
            <div class="xian">———————————</div>
            <li><a class="C001">我的资料库</a></li> <br />
            <li><a class="font1"  href="/Eventstar/book_lwj/book.jsp" class="selected">题库</a></li> <br />
            <li><a class="C001" href="#">设置</a></li> <br />
            <li><a class="C001" href="#">消息</a></li> <br />

        </ul>
    </div>
    <div id="d2">
        <h3 style="margin-left: 30px">题库</h3>
    <div id="maxbook">
        <img src="/Eventstar/img/book_tiku101.png" style="margin-left: 20px;margin-top: 20px">
        <span class="bookname">${bookname}</span>
        <form action="/Eventstar/book/book_addtimujsp?bookname=${bookname}" method="post" class="form1">
            <button class="btn1">添加试题</button>
        </form>
        <button class="btn2">修改题库</button>
        <button class="btn4">删除题库</button>
        <br><br>&emsp;&nbsp;
        <input type="checkbox" name="all" id="CheckAll">全选 &nbsp;
        <form action="/Eventstar/book/book_deltimus" method="post" class="form3">
        <button class="btn3">批量删除</button>
<c:forEach items="${timu}" var="t">
        <div class="title">
            <br>&emsp;
            <input type="checkbox" name="inp" value="${t.q_id}">&nbsp;<span class="timu">${t.q_name}</span>
            <br><br><span class="opt">A、</span>${t.q_a}<input type="text" name="bookname" value="${bookname}" style="display: none" >
            <br><br><span class="opt">B、</span>${t.q_b}
            <br><br><span class="opt">C、</span>${t.q_c}
            <br><br><span class="opt">D、</span>${t.q_d}
            <br><br><span class="opt">答案：</span>${t.q_answer}
            <div class="deltimu" tmid="${t.q_id}"></div>
            <a href="/Eventstar/book/book_updtimujsp?qid=${t.q_id}&bookname=${bookname}">
                <div class="updtimu"></div>
            </a>
        </div>
</c:forEach>
        </form>
    </div>
        <div class="fenye">
            <c:forEach begin="1" end="${count/5+1}" var='i'>
                <a href="/Eventstar/book/book_in?bookname=${bookname}&page=${i}"><div class="yema">${i}</div> </a>
            </c:forEach>
        </div>
    </div>
    <div id="new1">
        <div id="new1_head">
            <img src="/Eventstar/img/book_shezhi.png"> <span>删除设置</span>
        </div>
        <div id="d3">
            <form action="/Eventstar/book/book_del" method="post" >
                <br><br><br>
                <span class="s1">您是否确定删除该分组？</span>
                <div id="close"></div>
                <input type="text" name="bookid" value="${bookid}" style="display: none">
                <button>确定</button>
            </form>
        </div>
    </div>
    <div id="new2">
        <div id="new2_head">
            <img src="/Eventstar/img/book_shezhi.png"> <span>修改设置</span>
        </div>
        <div id="d4">
            <form action="/Eventstar/book/book_updbook" method="post" >
                <br><br><br>
                <span>请输入新名字:</span>
                <input type="text" placeholder="请输入新名字" value="${bookname}" class="upd_inp" name="upd_bookname">
                <div id="close2"></div>
                <input type="text" name="bookid" value="${bookid}" style="display: none">
                <button>确定</button>
            </form>
        </div>
    </div>

</div>
<img src="/Eventstar/img/book_foot.PNG">
</body>
</html>
